# -*- coding: utf-8 -*-
"""
@author: wyb
@date: 2023/12/11
@time: 21:22
@desc: Description
"""
from PIL import ImageColor
from PIL import Image

# img = Image.open('zophie.png')
# print(ImageColor.getcolor('red', 'RGBA'))
#
# img = Image.open('zophie.png')
# width, height = img.size
# print(str(width)+ ' H:' + str(height))
# print(img.filename)
# print(img.format)
# newimage = img.convert('RGB')
# newimage.save('catlogo.jpg')

# im1 = Image.new('RGBA',(100,200),'purple')
# im1.save('purpleImage.png')

# croppedIm = img.crop((335,345,565,560))
# croppedIm.save('cropped.png')

# catCopyIm = img.copy()
# faceIm = img.crop((335, 345, 565, 560))
# print(faceIm.size)
# catCopyIm.paste(faceIm,(0,0))
# catCopyIm.paste(faceIm,(400,500))
# catCopyIm.save('pasted.png')

# catWidth, catHeight = img.size
# faceWidth, faceHeight = faceIm.size
# catCopyTwo = img.copy()
# for left in range(0, catWidth, faceWidth):
#     for top in range(0, catHeight, faceHeight):
#         print(left, top)
#         catCopyTwo.paste(faceIm, (left, top))
# catCopyTwo.save('tiled.png')


# width, height = img.size
# quarterSizeImg = img.resize((int(width / 2), int(height / 2)))
# quarterSizeImg.save('quatersized.png')
#
# svelteIm = img.resize((width, height + 300))
# svelteIm.save('svelte.png')


# img.rotate(90).save('rotated90.png')
# img.rotate(180).save('rotated180.png')
# img.rotate(270).save('rotated270.png')

# img.transpose(Image.FLIP_LEFT_RIGHT).save('horizontal_flip.png')
# img.transpose(Image.FLIP_TOP_BOTTOM).save('Vertical_flip.png')


# myim = Image.new('RGBA', (100, 100))
# print(myim.getpixel((0, 0)))
# for x in range(100):
#     for y in range(50):
#         myim.putpixel((x, y), (210, 210, 210))
#
# for x in range(100):
#     for y in range(50, 100):
#         myim.putpixel((x, y), ImageColor.getcolor('darkgray', 'RGBA'))
#
# myim.save('putpixel.png')

logoImg = Image.open('catlogo.png')
width, height = logoImg.size
myimg = logoImg.resize((int(width / 5), int(height / 5)))
myimg.save('catlogo2.png')
